import { defineStore } from 'pinia'
import { getGoodsList } from '@/api/request'

export const useHomeStore = defineStore('home', {
    state: () => {
        return { 
            goodsList: [] ,
            loading:false,
            finished:false
        }
    },
    actions: {
        setGoodsList() {
            this.loading=true
            getGoodsList()
                .then(res => {
                    console.log(res, 'goodsList')
                    this.goodsList.push(...res)
                    this.loading=false
                })
        },
    },
})